import sqlite3

#此函数是封装函数，用来获取连接和关闭连接
'''
获取连接cursor，调用方式get_db_cursor(db_file)
返回 cursor,conn
'''
def get_db_cursor(db_file):
    conn=None
    try:
        conn=sqlite3.connect(db_file)
    except sqlite3.Error as e:
        print(e)

    if conn is not None:
        cursor=conn.cursor()
        return cursor,conn


'''
关闭连接 调用方式 close_connect_all(cursor,connect)
返回 空
'''
def close_connect_all(conn_cursor,connect):
    if conn_cursor is not None:
        conn_cursor.close()
    if connect is not None:
        connect.close()
